package com.hippo.core.core.network

import com.hippo.core.core.network.response.ApiResponse
import com.hippo.core.dto.LoginDto
import com.hippo.core.dto.RegisterDto
import com.hippo.core.model.BasicData
import com.hippo.core.model.ConsumablesInfo
import com.hippo.core.model.Country
import com.hippo.core.model.Faq
import com.hippo.core.model.FaqDetail
import com.hippo.core.model.LastVersion
import com.hippo.core.model.PageBean
import com.hippo.core.model.Product
import com.hippo.core.model.ProductDetail
import com.hippo.core.model.UserInfo
import com.hippo.core.state.LoginState
import com.hippo.core.state.RegisterState
import com.hippo.core.state.ResetPwdState
import okhttp3.MultipartBody
import retrofit2.http.Body
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Query

interface ApiService {

    //=============== 用户接口 ==========

    @POST("/Client/User/userRegister")
    suspend fun userRegister(@Body params: RegisterDto): ApiResponse<UserInfo>

    @POST("/Client/User/userLogin")
    suspend fun login(@Body params: LoginDto): ApiResponse<UserInfo>

    @POST("/Client/User/loginOut")
    suspend fun loginOut(): ApiResponse<Any>

    @POST("/Client/User/userOff")
    suspend fun userOff(): ApiResponse<Boolean>

    @POST("/Client/User/userOffPC")
    suspend fun userOffPC(@Body params: Map<String,String>): ApiResponse<Boolean>

    @GET("/Client/User/getUserInfo")
    suspend fun getUserInfo(): ApiResponse<UserInfo>

    @POST("/Client/User/resetPassword")
    suspend fun resetPassword(@Body params: ResetPwdState): ApiResponse<Boolean>

    @POST("/Client/User/changePassword")
    suspend fun changePassword(@Body params: Map<String,String>): ApiResponse<Boolean>

    @POST("/Client/User/changeUserEmail")
    suspend fun changeUserEmail(@Body params: Map<String,String>): ApiResponse<Boolean>

    @POST("/Client/User/changeNickName")
    suspend fun changeNickName(@Body params: Map<String,String>): ApiResponse<Boolean>

    @POST("/Client/User/changeAvatar")
    suspend fun changeAvatar(@Body params: Map<String,String>): ApiResponse<Boolean>

    @POST("/Client/Basic/sendEmail")
    suspend fun sendEmailCode(@Body params: Map<String,String>): ApiResponse<Boolean>

    @POST("/Client/Basic/chkEmailCode")
    suspend fun chkEmailCode(@Body params: Map<String,String>): ApiResponse<Boolean>


    // ==== 用户前端-产品接口 =====

    @GET("/Client/Product/getProductList")
    suspend fun getProductList(@Query("pageIndex") pageIndex:Int,@Query("pageSize") pageSize:Int): ApiResponse<PageBean<Product>>

    @GET("/Client/Product/getProductDetail")
    suspend fun getProductDetail(@Query("productId") productId:Int): ApiResponse<ProductDetail>

    @GET("/Client/Product/getProductFaqList")
    suspend fun getProductFaqList(@Query("pageIndex") pageIndex:Int,@Query("pageSize") pageSize:Int): ApiResponse<PageBean<Faq>>

    @GET("/Client/Product/getProductFaqDetail")
    suspend fun getProductFaqDetail(@Query("faqId") faqId:Int): ApiResponse<FaqDetail>



    // ==== 基础功能接口 =====


    @GET("/Client/Basic/getCountryList")
    suspend fun getCountryList(): ApiResponse<List<Country>>

    @GET("/Client/Basic/getBasicData")
    suspend fun getBasicData(): ApiResponse<BasicData>

    @GET("/Client/Basic/getLastVersion")
    suspend fun getLastVersion(@Query("appVersionNo") version:String): ApiResponse<LastVersion>

    @Multipart
    @POST("/Client/Basic/setFileUpload")
    suspend fun setFileUpload(@Part file: MultipartBody.Part): ApiResponse<String>


    @GET("/Client/Basic/getAndroidDownload")
    suspend fun getAndroidDownload(): ApiResponse<ProductDetail>

    @GET("/Client/Device/getDeviceWarn")
    suspend fun getConsumablesInfo(@Query("deviceId") deviceId: String): ApiResponse<ConsumablesInfo>

    @POST("/Client/Device/resetDeviceWarn")
    suspend fun resetDeviceWarn(@Body params: Map<String,String>): ApiResponse<Boolean>

//    @POST("/Client/Device/setDeviceData")
//    suspend fun setDeviceData(@Body params: Map<String,String>): ApiResponse<Boolean>

    @POST("/Client/Device/setDeviceWarn")
    suspend fun setDeviceWarn(@Body params: Map<String,String>): ApiResponse<Boolean>


}